{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Title: #Longest Uncommon Subsequence I"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Difficulty: #Easy"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Category Title: #Algorithms"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Tag Slug: #string"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Name Translated: #字符串"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solution Name: findLUSlength"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Translated Title: #最长特殊序列 Ⅰ"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Translated Content:\n",
    "<p>给你两个字符串&nbsp;<code>a</code>&nbsp;和&nbsp;<code>b</code>，请返回 <em>这两个字符串中 <strong>最长的特殊序列</strong>&nbsp;</em> 的长度。如果不存在，则返回 <code>-1</code>&nbsp;。</p>\n",
    "\n",
    "<p><strong>「最长特殊序列」</strong>&nbsp;定义如下：该序列为&nbsp;<strong>某字符串独有的最长子序列（即不能是其他字符串的子序列）</strong>&nbsp;。</p>\n",
    "\n",
    "<p>字符串&nbsp;<code>s</code>&nbsp;的子序列是在从&nbsp;<code>s</code>&nbsp;中删除任意数量的字符后可以获得的字符串。</p>\n",
    "\n",
    "<ul>\n",
    "\t<li>例如，<code>\"abc\"</code> 是 <code>\"aebdc\"</code> 的子序列，因为删除 <code>\"a<em><strong>e</strong></em>b<strong><em>d</em></strong>c\"</code> 中斜体加粗的字符可以得到 <code>\"abc\"</code> 。 <code>\"aebdc\"</code> 的子序列还包括 <code>\"aebdc\"</code> 、 <code>\"aeb\"</code> 和 <code>\"\"</code> (空字符串)。</li>\n",
    "</ul>\n",
    "\n",
    "<p>&nbsp;</p>\n",
    "\n",
    "<p><strong>示例 1：</strong></p>\n",
    "\n",
    "<pre>\n",
    "<strong>输入:</strong> a = \"aba\", b = \"cdc\"\n",
    "<strong>输出:</strong> 3\n",
    "<strong>解释:</strong> 最长特殊序列可为 \"aba\" (或 \"cdc\")，两者均为自身的子序列且不是对方的子序列。</pre>\n",
    "\n",
    "<p><strong>示例 2：</strong></p>\n",
    "\n",
    "<pre>\n",
    "<strong>输入：</strong>a = \"aaa\", b = \"bbb\"\n",
    "<strong>输出：</strong>3\n",
    "<strong>解释:</strong> 最长特殊序列是 \"aaa\" 和 \"bbb\" 。\n",
    "</pre>\n",
    "\n",
    "<p><strong>示例 3：</strong></p>\n",
    "\n",
    "<pre>\n",
    "<strong>输入：</strong>a = \"aaa\", b = \"aaa\"\n",
    "<strong>输出：</strong>-1\n",
    "<strong>解释:</strong> 字符串 a 的每个子序列也是字符串 b 的每个子序列。同样，字符串 b 的每个子序列也是字符串 a 的子序列。\n",
    "</pre>\n",
    "\n",
    "<p>&nbsp;</p>\n",
    "\n",
    "<p><strong>提示：</strong></p>\n",
    "\n",
    "<ul>\n",
    "\t<li><code>1 &lt;= a.length, b.length &lt;= 100</code></li>\n",
    "\t<li><code>a</code>&nbsp;和&nbsp;<code>b</code>&nbsp;由小写英文字母组成</li>\n",
    "</ul>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Description: [longest-uncommon-subsequence-i](https://leetcode.cn/problems/longest-uncommon-subsequence-i/description/)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solutions: [longest-uncommon-subsequence-i](https://leetcode.cn/problems/longest-uncommon-subsequence-i/solutions/)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "test_cases = ['\"aba\"\\n\"cdc\"', '\"aaa\"\\n\"bbb\"', '\"aaa\"\\n\"aaa\"']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return -1 if a == b else max(len(a), len(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return max(len(a), len(b)) if a!=b else -1\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        if a == b:\n",
    "            return -1\n",
    "        return max(len(a), len(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        ans = -1\n",
    "        temp=[]\n",
    "        temp2=[]\n",
    "        for i in range(len(a)):\n",
    "            for j in range(i+1,len(a)+1):\n",
    "                tmp = a[i:j]\n",
    "                temp.append(tmp)\n",
    "        for i in range(len(b)):\n",
    "            for j in range(i + 1, len(b) + 1):\n",
    "                tmp = b[i:j]\n",
    "                temp2.append(tmp)\n",
    "        temp.sort(key=len,reverse=True)\n",
    "        temp2.sort(key=len,reverse=True)\n",
    "        for i in temp:\n",
    "            if i not in b:\n",
    "                ans = max(ans,len(i))\n",
    "        for j in temp2:\n",
    "            if j not in a:\n",
    "                ans = max(ans,len(j))\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return max(len(a), len(b)) if a != b else -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        if a.find(b)>=0 and b.find(a)>=0:\n",
    "            return -1\n",
    "        else:\n",
    "            return max(len(a),len(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        if a in b and b in a:\n",
    "            return -1\n",
    "        else:\n",
    "            return max(len(a), len(b))\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        \n",
    "        if a == b:\n",
    "            return -1\n",
    "        \n",
    "        return max(len(a), len(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        \n",
    "        if a == b:\n",
    "            return -1\n",
    "        else:\n",
    "            return max(len(a), len(b))\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        if a==b:\n",
    "            return -1\n",
    "        return max(len(a),len(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        # 如果两个字符串的内容相同，返回-1\n",
    "        # 如果长度不同，返回长的长度\n",
    "        return -1 if a==b else max(len(a), len(b))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return -1 if a==b else max(len(a), len(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return -1 if a==b else max(len(a),len(b))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        len_a, len_b = len(a), len(b)\n",
    "        if len_a != len_b:\n",
    "            return max(len_a, len_b)\n",
    "        i = 0\n",
    "        for c_b in b:\n",
    "            while i < len_a and c_b != a[i]:\n",
    "                i += 1\n",
    "            if i == len_a:\n",
    "                return len_a\n",
    "            i += 1\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        # 不能是其他字符串的子序列\n",
    "        return max(len(a),len(b)) if a != b else -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution(object):\n",
    "    def findLUSlength(self, a, b):\n",
    "        if a==b:\n",
    "            return -1\n",
    "        else:\n",
    "            return max(len(a),len(b))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return -1 if a == b else max(len(a), len(b))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return -1 if a == b else max(len(a),len(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        \n",
    "        if a == b:\n",
    "            return -1\n",
    "        else:\n",
    "            return max(len(a), len(b))\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return -1 if a == b else max(len(a), len(b))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return max(len(a), len(b)) if a != b else -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        if a != b:\n",
    "            return max(len(a),len(b))\n",
    "        else:\n",
    "            return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return max(len(a), len(b)) if a != b else -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return -1 if a == b else max(len(a), len(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return max(len(a), len(b)) if a != b else -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        \n",
    "        if len(a) < len(b):\n",
    "            return len(b)\n",
    "        elif len(a) > len(b):\n",
    "            return len(a)\n",
    "        else:\n",
    "            if a == b:\n",
    "                return -1\n",
    "            else:\n",
    "                return len(a)\n",
    "\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        n1 = len(a)\n",
    "        n2 = len(b)\n",
    "        if n1!=n2:\n",
    "            return max(n1, n2)\n",
    "        else:\n",
    "            if a == b:\n",
    "                return -1\n",
    "            else:\n",
    "                return n1\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        m = len(a)\n",
    "        n = len(b)\n",
    "        j=0\n",
    "        if m != n: return max(m,n)\n",
    "        for i in range(m):\n",
    "            if a[i] == b[j]:\n",
    "                j += 1\n",
    "        if j == m:\n",
    "            return -1\n",
    "        else:\n",
    "            return m"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    # def findLUSlength(self, a: str, b: str) -> int:\n",
    "    #     # 这道题的意思是说只有a or b是另外一个的\"子串\"时才有效，否则就不是\n",
    "    #     # 双指针\n",
    "    #     if (len(a) < len(b)):\n",
    "    #         a1, b1 = b, a\n",
    "    #     else:\n",
    "    #         a1, b1 = a, b\n",
    "    #     x = len(a1)\n",
    "    #     y = len(b1)\n",
    "    #     i = 0\n",
    "    #     j = 0\n",
    "    #     cnt = 0\n",
    "    #     while (i < x and j < y):\n",
    "    #         if (a1[i] == b1[j]):\n",
    "    #             i += 1\n",
    "    #             j += 1\n",
    "    #             cnt += 1\n",
    "    #         else:\n",
    "    #             i += 1\n",
    "    #     if (cnt == y):\n",
    "    #         return x - y if x > y else -1\n",
    "    #     else:\n",
    "    #         return x\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        if (len(a) != len(b)):\n",
    "            return len(a) if len(a) > len(b) else len(b)\n",
    "        for i in range(len(a)):\n",
    "            if (a[i] != b[i]):\n",
    "                return len(a)\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return max(len(a),len(b)) if a!=b else -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        if len(a)!=len(b):\n",
    "            return max(len(a),len(b))\n",
    "        i=0\n",
    "        while i<len(a) and a[i]==b[i]:\n",
    "            i+=1\n",
    "        if i==len(a):\n",
    "            return -1\n",
    "        return len(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        m = len(a)\n",
    "        n = len(b)\n",
    "        return max(m,n) if a !=b else -1\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "      m,n=len(a),len(b)\n",
    "      return max(m,n) if a!=b else -1\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        # 如果两个字符串的内容相同，返回-1\n",
    "        # 如果长度不同，返回长的长度\n",
    "        return -1 if a==b else max(len(a), len(b))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        if a==b:\n",
    "            return -1\n",
    "        else:\n",
    "            return max(len(a),len(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        \n",
    "        if len(a) < len(b):\n",
    "            return len(b)\n",
    "        elif len(a) > len(b):\n",
    "            return len(a)\n",
    "        else:\n",
    "            if a == b:\n",
    "                return -1\n",
    "            else:\n",
    "                return len(a)\n",
    "\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        # if a != b:\n",
    "        #     return max(len(a),len(b))\n",
    "        # else:\n",
    "        #     return -1\n",
    "\n",
    "        # sa = []\n",
    "        # sb = []\n",
    "        # for i in range(len(a)):\n",
    "        #     if a[i] not in b:\n",
    "        #         sa.append(a[i])\n",
    "        #         i+=1\n",
    "        # for j in range(len(b)):\n",
    "        #     if b[j] not in a:\n",
    "        #         sb.append(b[j])\n",
    "        #         j+=1           \n",
    "        # if (len(sa)+len(sb)) != 0:\n",
    "        #     return max(len(sa),len(sb))\n",
    "        # else:\n",
    "        #     return -1\n",
    "        return (max(len(a),len(b)) if a != b else -1)\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        if a==b:\n",
    "            return -1\n",
    "        if len(a)<len(b):\n",
    "            return len(b)\n",
    "        else:\n",
    "            return len(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        la, lb = len(a), len(b)\n",
    "        if la != lb:\n",
    "            return max(la, lb)\n",
    "        elif a == b:\n",
    "            return -1\n",
    "        else:\n",
    "            return la\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        if a==b:\n",
    "            return -1\n",
    "        return max(len(a),len(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return max(len(a),len(b)) if a!=b else -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        if a == b:\n",
    "            return -1\n",
    "        return max(len(a), len(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        if a==b:\n",
    "            return -1\n",
    "        else:\n",
    "            return max(len(a),len(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return max(len(a), len(b)) if a != b else -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return max(len(a), len(b)) if a != b else -1\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return max(len(a), len(b)) if a != b else -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        if a == b:\n",
    "            return -1\n",
    "        else:\n",
    "            return max(len(a), len(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\r\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\r\n",
    "        return -1 if a==b else max(len(a), len(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        if a == b:\n",
    "            return -1\n",
    "        return max(len(a), len(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return -1 if a == b else max(len(a),len(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        if a != b:\n",
    "            return max(len(a), len(b))\n",
    "        else: return -1\n",
    "            \n",
    "            \n",
    "            "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        \n",
    "        if a == b:\n",
    "            return -1\n",
    "        else:\n",
    "            return max(len(a), len(b))\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        if a != b:\n",
    "            return max(len(a),len(b))\n",
    "        else:\n",
    "            return -1\n",
    "\n",
    "        # sa = []\n",
    "        # sb = []\n",
    "        # for i in range(len(a)):\n",
    "        #     if a[i] not in b:\n",
    "        #         sa.append(a[i])\n",
    "        #         i+=1\n",
    "        # for j in range(len(b)):\n",
    "        #     if b[j] not in a:\n",
    "        #         sb.append(b[j])\n",
    "        #         j+=1           \n",
    "        # if (len(sa)+len(sb)) != 0:\n",
    "        #     return max(len(sa),len(sb))\n",
    "        # else:\n",
    "        #     return -1\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return -1 if a == b else max(len(a),len(b)) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return max(len(a),len(b)) if a!=b else -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        if a == b: return -1\n",
    "        if len(a) != len(b): return max(len(a), len(b))\n",
    "        return len(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        \n",
    "        if a == b:\n",
    "            return -1\n",
    "        else:\n",
    "            return max(len(a), len(b))\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return max(len(a), len(b)) if a != b else -1\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        # m,n=len(a),len(b)\n",
    "        if len(a)!=len(b):\n",
    "            return max(len(a),len(b))\n",
    "        else:\n",
    "            return -1 if a==b else len(b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        if a==b:\n",
    "            return -1\n",
    "        # if len(set(a))==len(set(b)):\n",
    "        return max(len(a),len(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return -1 if a == b else max(len(a), len(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        # list_a = sorted(list(a))\n",
    "        # list_b = sorted(list(b))\n",
    "        # substring_a = []\n",
    "        # substring_b = []\n",
    "\n",
    "        # i = 0\n",
    "        # j = 0\n",
    "\n",
    "        # while(1):\n",
    "        #     if (i == len(list_a)) or (j == len(list_b)):\n",
    "        #         break\n",
    "        #     if list_a[i] == list_b[j]:\n",
    "        #         i += 1\n",
    "        #         j += 1\n",
    "        #         continue\n",
    "            \n",
    "        #     if list_a[i] < list_b[j]:\n",
    "        #         substring_a.append(list_a[i])\n",
    "        #         i += 1\n",
    "        #     elif list_a[i] > list_b[j]:\n",
    "        #         substring_b.append(list_b[j])\n",
    "        #         j += 1\n",
    "        \n",
    "        # if (i == len(list_a)):\n",
    "        #     while (j < len(list_b)):\n",
    "        #         substring_b.append(list_b[j])\n",
    "        #         j += 1\n",
    "\n",
    "        # if (j == len(list_b)):\n",
    "        #     while (i < len(list_a)):\n",
    "        #         substring_a.append(list_a[i]) \n",
    "        #         i += 1\n",
    "\n",
    "        # if (len(substring_a) == 0 and len(substring_b) == 0):\n",
    "        #     return -1\n",
    "\n",
    "        # return len(substring_a) if len(substring_b) < len(substring_a) else len(substring_b)\n",
    "        return max(len(a), len(b)) if a != b else -1\n",
    "\n",
    "            "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return max(len(a), len(b)) if a != b else -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return -1 if a == b else max(len(a), len(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return -1 if a == b else max(len(a), len(b))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def findLUSlength(self, a: str, b: str) -> int:\n",
    "        return -1 if a==b else max(len(a), len(b))"
   ]
  }
 ],
 "metadata": {},
 "nbformat": 4,
 "nbformat_minor": 2
}
